function front_desk()
{
    window.update = 1;
    $("#submit").show();
    $("#mobile_number").show();
    $("#queue_number").hide();

    $('button').click(
        function(e)
        {
            //Cancel the link behavior
            e.preventDefault();
            if(this.name == 'modal')
            {
                si = this.id;

                $("#queue_number_note").html('Enter your number for contact and confirmation purposes');
                //Get the A tag
                var id = '#dialog';

                //Get the screen height and width
                var maskHeight = $(document).height();
                var maskWidth = $(window).width();

                //Set heigth and width to mask to fill up the whole screen
                $('#mask').css({'width':maskWidth,'height':maskHeight});

                //transition effect
                $('#mask').fadeIn(1000);
                $('#mask').fadeTo("slow",0.8);

                //Get the window height and width
                var winH = $(window).height();
                var winW = $(window).width();

                //Set the popup window to center
                $(id).css('top',  winH/2-$(id).height()/2);
                $(id).css('left', winW/2-$(id).width()/2);

                //transition effect
                $(id).fadeIn(2000);

            }
            else if(this.name == 'submit')
            {
                mn = document.getElementById("mobile_number").value;
                if(mn != '')
                {
                    $.post(base_url + "ajax/new_queue_number",
                        { mobile_number: mn, service_id: si },
                        function(data)
                        {
                            $("#queue_number").html(data);
                            $("#submit").hide();
                            $("#mobile_number").hide();
                            $("#queue_number").show();
                            $("#queue_number_note").html('Please note of your number and wait for your queue number to be called');
                        }
                    );
                }
            }
        }
    );

    //if close button is clicked
    $('.window .close').click(
        function (e) {
            //Cancel the link behavior
            e.preventDefault();

            $('#mask').hide();
            $('.window').hide();
            $("#submit").show();
            $("#mobile_number").val('');
            $("#mobile_number").show();
            $("#queue_number").hide();
        }
    );

    //if mask is clicked
    /*
    $('#mask').click(
        function () {
            $(this).hide();
            $('.window').hide();
        }
    );
    */

    function sendLogs()
    {
        $.post(base_url + "sync/send_logs");
    }
    setInterval(sendLogs, 10000);
    function sync()
    {
        if(window.update == 1)
        {
            $.post(base_url + 'sync/update',
                function(data)
                {
                    if(data == 0)
                    {
                        window.update = 0;
                    }
                }, 'json'
            );
        }
    }
    setInterval(sync, 30000);
}